package com.eshipenet.shipnet.equipmentdatahub
import java.util.Properties

import org.apache.flink.streaming.api.functions.sink.SinkFunction
import org.apache.flink.streaming.connectors.kafka.FlinkKafkaProducer

object EquipmentDataSinkProvider {

  def createSink: SinkFunction[EquipmentData] = {
    val properties = new Properties()
    properties.setProperty("bootstrap.servers", "kafka-server:9092")
    properties.setProperty("group.id", "EquipmentDataProducer")
    val kafkaSink =
      new FlinkKafkaProducer[EquipmentData]("EquipmentData",
                                            new EquipmentDataKafkaSerializer(),
                                            properties,
                                            FlinkKafkaProducer.Semantic.EXACTLY_ONCE)
    kafkaSink
  }

}
